<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>葛庆的小项目</title>
        <style>
             *{
            padding: 0;
            margin: 0;
            text-decoration: none;
        }
        body {
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            background-color: #a29bfe;
            background-image: url('https://pic1.zhimg.com/80/v2-3afad658b44f596b10ec13b2b6d4299d_1440w.webp?source=1def8aca');
            background-size: cover;
        }
        .Login{
            width: 550px;
            height: 400px;
            display: flex;
            border-radius: 15px;
            justify-content: center;
            align-items: center;
            background: linear-gradient(
                to right bottom,
                rgba(255,255,255,.7),
                rgba(255,255,255,.5),
                rgba(255,255,255,.4)
            );
            /* 使背景模糊化 */
            backdrop-filter: blur(10px);
            box-shadow: 0 0 20px #a29bfe;
        }
        .table{
            font: 900 40px '';
            text-align: center;
            letter-spacing: 5px;
            color: #3d3d3d;
        }
        .box{
            overflow: hidden;
        }
        
        .box input{
            width: 100%;
            margin-bottom: 20px;
            outline: none;
            border: 0;
            padding: 10px;
            border-bottom: 3px solid rgb(150, 150, 240);
            background-color: transparent;
            font: 900 16px '';
        }
        .go{
            display: inline-block;
            height: 33.3%;
            text-align: center;
            display: block;
            height: 24px;
            padding: 12px;
            font: 900 20px '';
            border-radius: 10px;
            margin-top: 20px;
            color: #fff;
            letter-spacing: 3px;
            background-image: linear-gradient(to left, #AEEEEE, #a29bfe);
        }
  
        /* 悬浮在class="go"上时，渐变颜色改成#a29bfe到#AEEEEE */
        .go:hover{
            background-image: linear-gradient(to left,#86A8E7,#AEEEEE);
        }
        
        </style>
        
        </head>
    <body>
        <div class="Login">
        <form class="box">
            <p class="table">login</p>
            <br>
                <input type="text" placeholder="账号" id="username">
                <input type="password" placeholder="密码" id="password">
            <br>
            <a href="#" class="go" onclick="login()">登录</a>
            <a href="#" class="go" onclick="loginP()">免账号登录</a>
        </div>
        </form>
        </body>
        <script src="https://ajax.aspnetcdn.com/ajax/jquery/jquery-3.5.1.min.js"></script>
        <script type="text/javascript">
        let accountAll = [{  //存贮账户json数据的数组
            username: "admin",
            password: "123"
        },
        {
            username: "developer",
            password: "123"
        }
    ]

    //登录判断
    function login(){
        let username = document.getElementById("username").value;
        let password = document.getElementById("password").value;
        let account = accountAll.filter(function(e){
            return e.username == username
        })[0]
        if(!account){
            alert("用户名不存在")
        }else{
            if(account.username == username && account.password == password){
                alert("登录成功")
                
                if(account.username == "admin"){
                    window.location.href = "/admin"
                }else if(account.username == "developer"){
                    window.location.href = "/developer"
                }
            }else{
                alert("密码错误")
            }
        }

    }
//普通登录
    function loginP(){
        window.location.href = "/web"
    }
</script>
</html>